/*
 * 
 */
package cz.muni.fi.pb138.accountingRecords;

import java.math.BigDecimal;
import java.util.Date;

/**
 * Class representing payment
 * @author Jaroslav Klech
 */
public class Payment {
    
    private String id;
    private String bankAcc;
    private String destinationAcc;
    private BigDecimal amount;
    private Long variableSymbol;
    private Date transferDate;
    private String note;
    @Override
    public String toString() {
        return "Payment{" + "id=" + id + ", bankAcc=" + bankAcc + ", destinationAcc=" + destinationAcc + ", amount=" + amount + ", variableSymbol=" + variableSymbol + ", transferDate=" + transferDate + ", note=" + note + '}';
    }

    /**
     * returns amount that was payed
     * @return amount that was payed
     */
    public BigDecimal getAmount() {
        return amount;
    }

    /**
     * sets amount that was payed
     * @param amount amount that was payed
     */
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    /**
     * returns bank account of sender
     * @return bank account of sender
     */
    public String getBankAcc() {
        return bankAcc;
    }

    /**
     * sets bank account of sender
     * @param bankAcc bank account of sender
     */
    public void setBankAcc(String bankAcc) {
        this.bankAcc = bankAcc;
    }

    /**
     * returns bank account of reciever
     * @return bank account of reciever
     */
    public String getDestinationAcc() {
        return destinationAcc;
    }

    /**
     * returns bank account of reciever
     * @param destinationAcc bank account of reciever
     */
    public void setDestinationAcc(String destinationAcc) {
        this.destinationAcc = destinationAcc;
    }

    /**
     * returns internal ID of payment in database
     * @return internal ID of payment in database
     */
    public String getId() {
        return id;
    }

    /**
     * sets internal ID of payment in database
     * @param id internal ID of payment in database
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * returns note for reciever attached to payment
     * @return note for reciever attached to payment
     */
    public String getNote() {
        return note;
    }

    /**
     * sets note for reciever attached to payment
     * @param note note for reciever attached to payment
     */
    public void setNote(String note) {
        this.note = note;
    }

    /**
     * returns date of transfer
     * @return date of transfer
     */
    public Date getTransferDate() {
        return transferDate;
    }

    /**
     * sets date of transfer
     * @param transferDate date of transfer
     */
    public void setTransferDate(Date transferDate) {
        this.transferDate = transferDate;
    }

    /**
     * returns variable symbol of transfer
     * @return variable symbol of transfer
     */
    public Long getVariableSymbol() {
        return variableSymbol;
    }

    /**
     * sets variable symbol of transfer
     * @param variableSymbol variable symbol of transfer
     */
    public void setVariableSymbol(Long variableSymbol) {
        this.variableSymbol = variableSymbol;
    }

    /**
     * compares two payments, they are same if their attributes are same
     * @param obj payment that will be compared
     * @return true if payments have same attributes, false otherwise
     */
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Payment other = (Payment) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if ((this.bankAcc == null) ? (other.bankAcc != null) : !this.bankAcc.equals(other.bankAcc)) {
            return false;
        }
        if ((this.destinationAcc == null) ? (other.destinationAcc != null) : !this.destinationAcc.equals(other.destinationAcc)) {
            return false;
        }
        if (this.amount != other.amount && (this.amount == null || !this.amount.equals(other.amount))) {
            return false;
        }
        if (this.variableSymbol != other.variableSymbol && (this.variableSymbol == null || !this.variableSymbol.equals(other.variableSymbol))) {
            return false;
        }
        if (this.transferDate != other.transferDate && (this.transferDate == null || !this.transferDate.equals(other.transferDate))) {
            return false;
        }
        if ((this.note == null) ? (other.note != null) : !this.note.equals(other.note)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 97 * hash + (this.bankAcc != null ? this.bankAcc.hashCode() : 0);
        hash = 97 * hash + (this.destinationAcc != null ? this.destinationAcc.hashCode() : 0);
        hash = 97 * hash + (this.amount != null ? this.amount.hashCode() : 0);
        hash = 97 * hash + (this.variableSymbol != null ? this.variableSymbol.hashCode() : 0);
        hash = 97 * hash + (this.transferDate != null ? this.transferDate.hashCode() : 0);
        hash = 97 * hash + (this.note != null ? this.note.hashCode() : 0);
        return hash;
    }


    
    
}
